
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1>请求参数处理</h1>
1,前端给后端发送的数据 是一个标量:(字符串 数字  日期)
<form action="test1" method="POST">
    <input type="text" name="username" placeholder="用户名"> <br>
    <input type="text" name="age" placeholder="用户年龄"> <br>
    <input type="text" name="birthday" placeholder="生日"> <br>
    <input type="submit" value="提交">
</form>
<hr>
2.前端name属性和 后端的形参名不一样
<form action="test2">
    <input type="text" name="uname" placeholder="用户名"> <br>
<%--    <input type="text" name="uage" placeholder="用户年龄"> <br>--%>
    <input type="text" name="ubirth" placeholder="生日"> <br>
    <input type="submit" value="提交">
</form>

<hr>
3.多个请求参数 封装成一个对象后端接受
<form action="test3">

    <input type="text" name="username" placeholder="用户名"> <br>
    <input type="text" name="age" placeholder="用户年龄"> <br>
    <input type="text" name="birthday" placeholder="生日"> <br>
    <input type="text" name="mobile.brand" placeholder="手机品牌"> <br>
    <input type="text" name="mobile.moType" placeholder="手机信号"> <br>
    <input type="submit" value="提交">
</form>

4.某个参数的值是 多个的时候，用数组接受
<form action="test4">
    <input type="checkbox" name="hobby" value="sing"> 唱
    <input type="checkbox" name="hobby" value="dance">跳
    <input type="checkbox" name="hobby" value="basketball"> 篮球
    <input type="checkbox" name="hobby" value="rap"> Rap
    <input type="submit" value="提交">
</form>
<hr>
5.某个对象的某个属性是 数组的形式
<form action="test5">
    <input type="text" name="username" placeholder="用户名"> <br>
    <input type="text" name="age" placeholder="用户年龄"> <br>
    <input type="text" name="birthday" placeholder="生日"> <br>
    <input type="checkbox" name="hobbies" value="sing"> 唱
    <input type="checkbox" name="hobbies" value="dance">跳
    <input type="checkbox" name="hobbies" value="basketball"> 篮球
    <input type="checkbox" name="hobbies" value="rap"> Rap
    <input type="text" name="pageNum" placeholder="我不是用户对象的属性~">
    <input type="submit" value="提交">
</form>

<hr>
6.多个 参数（复选框） 用 集合来接受
<form action="test6">
    <input type="checkbox" name="hobby" value="sing"> 唱
    <input type="checkbox" name="hobby" value="dance">跳
    <input type="checkbox" name="hobby" value="basketball"> 篮球
    <input type="checkbox" name="hobby" value="rap"> Rap
    <input type="submit" value="提交">
</form>
<hr>

7.某个对象的某个属性是 集合的形式
<form action="test7">
    <input type="text" name="username" placeholder="用户名"> <br>
    <input type="text" name="age" placeholder="用户年龄"> <br>
    <input type="text" name="birthday" placeholder="生日"> <br>
    <input type="checkbox" name="hobbies" value="sing"> 唱
    <input type="checkbox" name="hobbies" value="dance">跳
    <input type="checkbox" name="hobbies" value="basketball"> 篮球
    <input type="checkbox" name="hobbies" value="rap"> Rap
    <input type="submit" value="提交">
</form>

<hr>

8.某个对象的某个属性是 Map集合的形式
<form action="test8">
    <input type="text" name="username" placeholder="用户名"> <br>
    <input type="text" name="age" placeholder="用户年龄"> <br>
    <input type="text" name="birthday" placeholder="生日"> <br>
    <input type="checkbox" name="hobbies" value="sing"> 唱
    <input type="checkbox" name="hobbies" value="dance">跳
    <input type="checkbox" name="hobbies" value="basketball"> 篮球
    <input type="checkbox" name="hobbies" value="rap"> Rap <br>
    <input type="text" name="relations[father]" placeholder="父亲名字"> <br>
    <input type="text" name="relations['mother']" placeholder="母亲名字"> <br>
    <input type="submit" value="提交">
</form>
</body>
</html>
